package cn.iotab.iotkit.transport.api.common.queue;

import cn.iotab.iotkit.queue.queue.QueueMsg;
import cn.iotab.iotkit.queue.queue.QueueProducer;

public class StatsCallback implements QueueProducer.QueueCallback {
    private final QueueProducer.QueueCallback callback;

    public StatsCallback(QueueProducer.QueueCallback callback) {
        this.callback = callback;
    }

    @Override
    public void onSuccess(QueueMsg.Metadata metadata) {
        if (callback != null)
            callback.onSuccess(metadata);
    }

    @Override
    public void onFailure(Throwable t) {
        if (callback != null)
            callback.onFailure(t);
    }
}